package com.offcn.controller;


import com.offcn.utils.Result;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xinyi
 * @since 2021-07-14
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/getUsername")
    public Result getUsername(){

        String username= SecurityContextHolder.getContext().getAuthentication().getName();
        return new Result(true,"",username);
    }
}

